'use strict';

/* Controllers */

var phonecatControllers = angular.module('phonecatControllers', ['ui.bootstrap']);

phonecatControllers.controller('PhoneListCtrl', ['$scope', 'Phone',
    function ($scope, Phone) {
        $scope.phones = Phone.query();
        $scope.orderProp = 'age';
        $scope.selected = undefined;
        var phoneCount = $scope.phones.length;
        $scope.phoneNames = ["Motorola XOOM™ with Wi-Fi",
            "MOTOROLA XOOM™",
            "MOTOROLA ATRIX™ 4G",
            "Dell Streak 7",
            "Samsung Gem™",
            "Dell Venue",
            "Nexus S",
            "LG Axis",
            "Samsung Galaxy Tab™",
            "Samsung Showcase™ a Galaxy S™ phone",
            "DROID™ 2 Global by Motorola",
            "DROID™ Pro by Motorola",
            "MOTOROLA BRAVO™ with MOTOBLUR™",
            "Motorola DEFY™ with MOTOBLUR™",
            "T-Mobile myTouch 4G",
            "Samsung Mesmerize™ a Galaxy S™ phone",
            "SANYO ZIO",
            "Samsung Transform™",
            "T-Mobile G2",
            "Motorola CHARM™ with MOTOBLUR™"];





    }]);

phonecatControllers.controller('PhoneDetailCtrl', ['$scope', '$routeParams', 'Phone',
    function ($scope, $routeParams, Phone) {
        $scope.phone = Phone.get({phoneId: $routeParams.phoneId}, function (phone) {
            $scope.mainImageUrl = phone.images[0];
        });

        $scope.setImage = function (imageUrl) {
            $scope.mainImageUrl = imageUrl;
        };


    }]);

